//
//  TakePhotoRecordingView.m
//  TeamInformatization
//
//  Created by bigger on 2019/4/3.
//  Copyright © 2019年 SPIC. All rights reserved.
//

#import "TakePhotoRecordingView.h"

@interface TakePhotoRecordingView ()

// 照片
@property (nonatomic, strong) UIImageView *photoImageView;
// 录音
@property (nonatomic, strong) UIImageView *recordingImageView;
// 录音转文字
@property (nonatomic, strong) UITextView *questionTextView;
// 标题
@property (nonatomic, strong) SimpleLabel *scanTitleLabel;
// 扫描显示
@property (nonatomic, strong) SimpleLabel *scanContentLabel;


@end

@implementation TakePhotoRecordingView

- (instancetype)init
{
    if (self = [super init]) {
        self.backgroundColor = [UIColor whiteColor];
        [self creatViews];
    }
    return self;
}

- (void)creatViews
{
    // 拍照
    self.photoImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"分组 2"]];
    [self addSubview:_photoImageView];
    [_photoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(20 * kScaleWidth);
        make.centerX.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(kScreenWidth - 30 * kScaleWidth, 184 * kScaleWidth));
    }];
    
    // 录音
    self.recordingImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"分组-1"]];
    [self addSubview:_recordingImageView];
    [_recordingImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.photoImageView.mas_bottom).offset(10 * kScaleWidth);
        make.centerX.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(kScreenWidth - 30 * kScaleWidth, 140 * kScaleWidth));
    }];
    
    // 问题描述
    self.questionTextView = [[UITextView alloc] init];
    [self addSubview:_questionTextView];
    [_questionTextView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.recordingImageView.mas_bottom).offset(10 * kScaleWidth);
        make.centerX.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(kScreenWidth - 30 * kScaleWidth,137 * kScaleWidth));
    }];
    _questionTextView.layer.borderWidth = 1;
    _questionTextView.layer.borderColor = kSetRGBColor(241, 241, 241, 1).CGColor;
    
    
    // 扫描标题
    self.scanTitleLabel = [SimpleLabel initWithText:@"人员到位:" TextColor:kTitleTextColor TextFont:[UIFont fontWithName:@"PingFang-SC-Regular" size: 15] TextAlignment:NSTextAlignmentLeft];
    [self addSubview:_scanTitleLabel];
    [_scanTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15 * kScaleWidth);
        make.top.mas_equalTo(self.questionTextView.mas_bottom).offset(20 * kScaleWidth);
    }];
    // 扫描按钮
    UIButton *scanButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [scanButton setImage:[UIImage imageNamed:@"saomiao"] forState:UIControlStateNormal];
    [scanButton addTarget:self action:@selector(scanrelatedCode:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:scanButton];
    [scanButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15 * kScaleWidth);
        make.centerY.mas_equalTo(self.scanTitleLabel);
    }];
    
    SimpleLabel *textLabel = [SimpleLabel initWithText:@"请扫码" TextColor:kSetRGBColor(153, 153, 153, 1) TextFont:kFont(PFSCRegular, 13) TextAlignment:NSTextAlignmentRight];
    [self addSubview:textLabel];
    [textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(scanButton.mas_left).offset(-5 * kScaleWidth);
        make.centerY.mas_equalTo(self.scanTitleLabel);
    }];
    
    // 分割线
    UILabel *lineLabel1 = [[UILabel alloc] init];
    lineLabel1.backgroundColor = kSetRGBColor(245, 245, 245, 1);
    [self addSubview:lineLabel1];
    [lineLabel1 mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.scanTitleLabel.mas_bottom).offset(12 * kScaleWidth);
        make.left.mas_equalTo(15 * kScaleWidth);
        make.right.mas_equalTo(-15 * kScaleWidth);
        make.height.mas_equalTo(0.5);
    }];
    
    
    // 扫描内容
    SimpleLabel *scanTextLabel = [SimpleLabel initWithText:@"扫码内容:  " TextColor:kTitleTextColor TextFont:kFont(PFSCRegular, 15) TextAlignment:NSTextAlignmentLeft];
    [self addSubview:scanTextLabel];
    [scanTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.scanTitleLabel);
        make.top.mas_equalTo(self.scanTitleLabel.mas_bottom).offset(24 * kScaleWidth);
    }];
    
    self.scanContentLabel = [SimpleLabel initWithText:@"" TextColor:kTitleTextColor TextFont:[UIFont fontWithName:@"PingFang-SC-Regular" size: 15] TextAlignment:NSTextAlignmentLeft];
    [self addSubview:_scanContentLabel];
    [_scanContentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(scanTextLabel.mas_right);
        make.centerY.mas_equalTo(scanTextLabel);
    }];
    
    // 分割线
    UILabel *lineLabel = [[UILabel alloc] init];
    lineLabel.backgroundColor = kSetRGBColor(245, 245, 245, 1);
    [self addSubview:lineLabel];
    [lineLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(scanTextLabel.mas_bottom).offset(12 * kScaleWidth);
        make.left.mas_equalTo(15 * kScaleWidth);
        make.right.mas_equalTo(-15 * kScaleWidth);
        make.bottom.mas_equalTo(-32 * kScaleWidth);
        make.height.mas_equalTo(0.5);
    }];
    
}


// 扫描
- (void)scanrelatedCode:(UIButton *)sender
{
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
